<template>
  <view class="header">
    <view class="left">
      <view class="line"></view>
      <view class="title">
        {{ title }}
      </view>
    </view>
    <view class="right">
      <view v-for="item in legend" :key="item.index" class="legend-item">
        <view class="round" :style="{ backgroundColor: item.color }"></view>
        <view class="name">{{ item.name }}</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: ''
    },
    legend: {
      type: Array,
      default: () => []
    }
  }
};
</script>

<style scoped lang="scss">
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  .left {
    display: flex;
    align-items: center;
    .line {
      width: 8rpx;
      height: 28rpx;
      background: #f75a3e;
      border-radius: 4rpx;
      margin-right: 16rpx;
    }
    .title {
      font-weight: bold;
      font-size: 32rpx;
      color: #000000;
    }
  }
  .right {
    display: flex;
    .legend-item {
      display: flex;
      align-items: center;
      margin-right: 16rpx;
      .round {
        width: 12rpx;
        height: 12rpx;
        border-radius: 50%;
        margin-right: 8rpx;
      }
      .name {
        font-weight: 400;
        font-size: 24rpx;
        color: #999999;
      }
    }
  }
}
</style>
